import request from '@/utils/request'
// 工单管理

// 工单状态列表
export const allTaskStatus = () => {
  return request({
    url: '/api/task-service/task/allTaskStatus'
  })
}
// 工单搜索
export const search = (params) => {
  return request({
    url: '/api/task-service/task/search',
    params
  })
}
// 创建工单
export const create = (data) => {
  return request({
    url: '/api/task-service/task/create',
    method: 'POST',
    data
  })
}
// 获取所有工单类型
// /api/task-service/taskType/list
export const taskType = () => {
  return request({
    url: '/api/task-service/taskType/list'
  })
}
// 获取工单详情

export const taskInfo = (taskId) => {
  return request({
    url: `/api/task-service/task/taskInfo/${taskId}`
  })
}
// 获取补货预警值

export const supplyAlertValue = () => {
  return request({
    url: `/api/task-service/task/supplyAlertValue`
  })
}
// 设置自动补货工单阈值
export const autoSupplyConfig = (data) => {
  return request({
    url: `/api/task-service/task/autoSupplyConfig`,
    method: 'POST',
    data
  })
}
// 取消工单
export const cancel = ({ taskId }) => {
  return request({
    url: `/api/task-service/task/cancel/${taskId}`,
    method: 'POST',
    data: {
      taskId
    }
  })
}
// 补货详情
export const taskDetails = (taskId) => {
  return request({
    url: `/api/task-service/taskDetails/${taskId}`
  })
}
